﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpBolt.Basics;

namespace SharpBolt.Sound
{
    public class SoundPlayer : SharpBolt.Sound.ISoundInstance
    {
        internal SbSound bsound;

        double volume;
        public double Volume
        {
            set
            {
                Engine.SoundRender.SetVolume(bsound, value);
                volume = value;
            }
            get
            {
                return volume;
            }
        }
        double pan;
        public double Pan
        {
            set
            {
                pan = value;
            }
            get
            {
                return pan;
            }
        }

        public void Play(bool loop = false)
        {
            Engine.SoundRender.SetVolume(bsound, volume);
            Engine.SoundRender.Play(bsound, loop);
        }

        public void Pause()
        {
            Engine.SoundRender.Pause(bsound);
        }

        public void Continue()
        {
            Engine.SoundRender.Continue(bsound);
        }

        public void Stop()
        {
            Engine.SoundRender.Stop(bsound);
        }

        public bool IsStopped()
        {
            return Engine.SoundRender.IsStopped(bsound);
        }

        internal SoundSource source;
        public SoundSource Source()
        {
            return source;
        }
    }
}
